﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Univar
{
    /// <summary>
    /// The source storage types from which values can be read.
    /// </summary>
    public enum Sources
    {
        None = 0,

        QueryString = 1,

        Session = 2,
        /// <summary>
        /// The session storage with a scope limited to the current page only.
        /// </summary>
        LocationBoundSession = 4,

        Cookie = 8,
        /// <summary>
        /// The cookie storage with a scope limited to the current page only.
        /// It will no longer be available to the user when the cookie expires.
        /// </summary>
        LocationBoundCookie = 16,
        /// <summary>
        /// The cookie storage with a scope limited to the current session only. 
        /// It will no longer be available to the user when the session expires.
        /// </summary>
        SessionBoundCookie = 32,
        /// <summary>
        /// The cookie storage with a scope limited to the current page only.
        /// </summary>
        UserBoundCookie = 64,

        Cache = 128,
        /// <summary>
        /// The cache storage with a scope limited to the current page only.
        /// </summary>
        LocationBoundCache = 256,
        /// <summary>
        /// The cache storage with a scope limited to the current session only. 
        /// It will no longer be available to the user when the session expires.
        /// </summary>
        SessionBoundCache = 512,
        /// <summary>
        /// The cache storage with a scope limited to the current page only.
        /// </summary>
        UserBoundCache = 1024,
        /// <summary>
        /// The cache storage with a scope limited to the current browser only by makint use of an autogenerated id stored in a cookie.
        /// </summary>
        BrowserBoundCache = 2048,
        /// <summary>
        /// A storage using a server side file to store data as json text.
        /// </summary>
        InFileCache = 4096,
        LocationBoundInFileCache = 8192,
        UserBoundInFileCache = 16384,
        SessionBoundInFileCache = 32768,
        BrowserBoundInFileCache = 65536,

        //Memcached 
    }

    /// <summary>
    /// The storage types where values can be stored.
    /// Each type has is represented by an unsigned integer that can be added up to denote several types within the same integer.
    /// </summary>
    public struct Targets
    {
        public const int
        None = 0,

        QueryString = 1,

        Session = 2,
        /// <summary>
        /// The session storage with a scope limited to the current location only.
        /// </summary>
        LocationBoundSession = 4,

        Cookie = 8,
        /// <summary>
        /// The cookie storage with a scope limited to the current page only.
        /// </summary>
        LocationBoundCookie = 16,
        /// <summary>
        /// The cookie storage with a scope limited to the current session only. 
        /// A null value will be returned after the user logs off or his sessin expires
        /// but the data will still be available in the cookie until it expires.
        /// </summary>
        SessionBoundCookie = 32,
        /// <summary>
        /// The cookie storage with a scope limited to the current page only.
        /// A null value will be returned after the user logs off or his sessin expires
        /// but the data will still be available in the cookie until it expires.
        /// </summary>
        UserBoundCookie = 64,

        Cache = 128,
        /// <summary>
        /// The cache storage with a scope limited to the current page only.
        /// </summary>
        LocationBoundCache = 256,
        /// <summary>
        /// The cache storage with a scope limited to the current session only. 
        /// It will no longer be available to the user when the session expires.
        /// </summary>
        SessionBoundCache = 512,
        /// <summary>
        /// The cache storage with a scope limited to the current page only.
        /// </summary>
        UserBoundCache = 1024,
        /// <summary>
        /// The cache storage with a scope limited to the current browser only by makint use of an autogenerated id stored in a cookie.
        /// </summary>
        BrowserBoundCache = 2048,
        /// <summary>
        /// A storage using a server side file to store data as json text.
        /// </summary>
        InFileCache = 4096,
        LocationBoundInFileCache = 8192,
        UserBoundInFileCache = 16384,
        SessionBoundInFileCache = 32768,
        BrowserBoundInFileCache = 65536;

        //Memcached 
    }

    /// <summary>
    /// Provides a means for limiting the scope of a storage by including the page, user or session id in the storage key.
    /// The BrowserCookie option however makes use of an autogenerated cookie id to make the key unique to each browser.
    /// </summary>
    public enum Scopes
    {
        Default,
        /// <summary>
        /// Limits the scope of a variable to the current location only.
        /// </summary>
        Location,
        /// <summary>
        /// Limits the scope of a variable to the currently logged on user only.
        /// </summary>
        User,
        /// <summary>
        /// Limits the scope of a variable to the current session only.
        /// </summary>
        Session,
        /// <summary>
        /// Limits the scope of a variable to the current browser only via an autogenerated id stored in a cookie.
        /// </summary>
        Browser
    }

    public enum SessionIdentitySource
    {
        Default,
        PageBound
    }
}
